package cn.yshujia.handler;

import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
import org.apache.ibatis.reflection.MetaObject;
import org.springframework.stereotype.Component;

import java.util.Date;

@Component
public class MetaHandler implements MetaObjectHandler {
	
	public void insertFill(MetaObject metaObject) {
		strictInsertFill(metaObject, "createTime", Date.class, new Date(System.currentTimeMillis()));
		strictInsertFill(metaObject, "updateTime", Date.class, new Date(System.currentTimeMillis()));
	}
	
	public void updateFill(MetaObject metaObject) {
		strictUpdateFill(metaObject, "updateTime", Date.class, new Date(System.currentTimeMillis()));
	}
}